#ifndef _IMAGE_GEN_GENFROMMEMORY_
#define _IMAGE_GEN_GENFROMMEMORY_

#include "../../../function.h"

namespace sp::Image::Gen{

void registe_genFromMemory();

/* 
    从内存中读取视频流
*/
class genFromMemory: public Function{
private:
    char* video_ptr_head;
    char* current_video_ptr;
    long index;
    int fps;
    long size;
    int width;
    int height;
    struct timeval time_start;
    bool isFirst;
    long cnt;
public:
    genFromMemory(std::vector<std::string> v); // long fps, cv::Mat* data_source, long size
    genFromMemory(char* video_ptr_head, long size, int fps, int width, int height); // input_video_data_ptr, cnt, 30, 3840, 2160
    genFromMemory();
    virtual ~genFromMemory();
    static void registe();
    static Function* createObject(std::vector<std::string> params);
    static Function* createObject2();
    virtual void start();
    virtual bool waitForResource();
    virtual void process(std::vector<std::vector<Data*>>& data_input, std::vector<Data*>& data_output);
    virtual bool releaseResource();
    virtual void finish();
    virtual void copy(Function* other);
};

};

#endif